<template>
  <div>
    <el-button @click="currentlang='zh'">中文</el-button>
    <el-button @click="currentlang='en'">english</el-button>
    <div class="content">
      {{ translate(currentlang) }}
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      currentlang: 'zh',
      message: {
        zh: {
          sayhi() {
            return '傻逼逼'
          }
        },
        en: {
          sayhi() {
            return 'sillyB'
          }
        }
      }
    }
  },
  methods: {
    translate(str) {
      console.log(str)
      return this.message[str].sayhi()
    }
  }
}
</script>

<style>

</style>
